package com.sodaopen.study.service.impl;

import com.sodaopen.study.entity.Course;
import com.sodaopen.study.mapper.ClazzMapper;
import com.sodaopen.study.mapper.CourseMapper;
import com.sodaopen.study.service.CourseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Override
    public List<Course> findByStageId(Integer id, Integer userId) {
        return courseMapper.selectByStageId(id, userId);
    }

	@Override
	public Course findById(Integer id) {
		return courseMapper.selectById(id);
	}

    @Override
    public List<Course> findByParam() {
        return courseMapper.selectByParam();
    }

    @Override
    public void saveCourse(Course course) {
        courseMapper.insertCourse(course);
    }

    @Override
    public Integer findMaxSort(Integer stageId) {
        return courseMapper.selectMaxSort(stageId);
    }

	@Override
	public List<Course> findClazzNotAssignCourse(Integer clazzId) {
		return courseMapper.selectClazzNotAssignCourse(clazzId);
	}
}
